using System;
using System.Collections.Generic;
using System.Text;

using PickGold;
using PickGold.Database;
using DataCommon = PickGold.Database.Common;

namespace PickGold.Entities.Table
{
    public class CBaseBrandInfo : CBaseTable
    {
        //
        public const string ENTITY_NAME = "tb_sys_brand_info";
        public const string ENTITY_ALIAS = "brands";
		public const string ENTITY_KEY = DataCommon.BRAND_ID;
		public const string ENTITY_SYMBOL = DataCommon.BRAND_NAME;
        //
        public const string ITEM_ICO = "item_ico";
        public const string ITEM_BIRTHDAY = "item_birthday";
		public const string ITEM_NOTE = DataCommon.ITEM_NOTE;
        //
        private SBaseBrandInfo _ = null;
        //
        public CBaseBrandInfo() : base(ENTITY_NAME, ENTITY_ALIAS) { }
        public CBaseBrandInfo(CDatabase db) : base(db, ENTITY_NAME, ENTITY_ALIAS) { }
        public CBaseBrandInfo(string alias) : base(ENTITY_NAME, alias) { }
        public CBaseBrandInfo(CDatabase db, string alias) : base(db, ENTITY_NAME, alias) { }
        //
        protected override void SetSchema()
        {
            this.SetSchema(new SBaseBrandInfo());
        }
        protected void SetSchema(SBaseBrandInfo s)
        {
            this._ = s;
            base.SetSchema(s);
        }
        //
        protected override void PreInitSchema()
        {
            base.PreInitSchema();
            this._DataTable.Columns.Add(ITEM_ICO, typeof(long)).DefaultValue = this._.ItemIco;
            this._DataTable.Columns.Add(ITEM_BIRTHDAY, typeof(DateTime)).DefaultValue = this._.ItemBirthday;
            this._DataTable.Columns.Add(ITEM_NOTE, typeof(string)).MaxLength = 2048;
        }
        //
        #region Property
        //
        public long ItemIco
        {
            set
            {
                this._.ItemIco = value;
                this.SetValue(ITEM_ICO, value);
            }
            get
            {
                return this._.ItemIco;
            }
        }
        //
        public DateTime ItemBirthday
        {
            set
            {
                this._.ItemBirthday = value;
                this.SetValue(ITEM_BIRTHDAY, value);
            }
            get
            {
                return this._.ItemBirthday;
            }
        }
        //
        public string ItemNote
        {
            set
            {
                this._.ItemNote = value;
                this.SetValue(ITEM_NOTE, value);
            }
            get
            {
                return this._.ItemNote;
            }
        }
        //
        #endregion
        //
		public override bool MoveTo(int position)
		{
			if (!base.MoveTo(position))
				return false;

			this._.ItemIco = this.GetValue<long>(ITEM_ICO, true);
			this._.ItemBirthday = this.GetValue<DateTime>(ITEM_BIRTHDAY, true);
			this._.ItemNote = this.GetValue<string>(ITEM_NOTE, true);
			return true;
		}
        //
    }
    //
    public class SBaseBrandInfo : SBaseTable
    {
        //
        public long ItemIco = -1;
        public DateTime ItemBirthday = DateTime.MinValue;
        public string ItemNote = null;
        //
    }
    //
}
//
